Hello and welcome.
In this lecture we are going to create functionality for our image slider using javascript.
All right.
So this is my blank scrip file.
So we're what I'm going to do.
I've already pre written the code.
I'm just going to add a code and explain what the code does.
So I had the code that will create the functionality for this Slider.
So there are three functions here.
We've got the first function here.
Sorry two functions go function here called plaze Dave's and we go from here.
Sure did.
So I started off on line one by defining a variable called Slide index and I've set the value to one
line two.
I have called the function.
This function here calls should d the end there means whatever value you pass in and I've passed it.
This light Index which has this slide index the value values once I've passed it one here.
Write line for those quoted function call plus div and inside the parenthesis were parsee n that n represents
a value.
Ah could be an integer value could be one to whatever.
Okay and that function this function here code plus the also takes seem this parameter SQL what this
function does it all this function plus the calls this function as well so this function should do is
being called from here.
So we want a qualifying job you just type in the name and then you parsee the parrot Param if s passed
its slide index which is this variable here of 1 plus or equal to use in this proton plus a week was
to N.
So to be plausible equal to whatever that n represents.
Okay so N could be a number two three if once or K.
That's why the Super Bowl will always send a whatever's slide.
No you passed since always start with a slide number one to an ADD slag Member 2 and so on thus what
that n represents the function on line 8 to 17 what that function shule gives.
Remember the images are indeed.
So I said sure D and have passed it in passed down to the parentheses an n value.
So we've got a variable called Hi.
This I will act as a counter variable on line 10 core variable x and I've set it to cause to a document
a get elemen by class name k. and the class name up past did my slides remember if I go to the hastier
mail world class chord slides.
Okay so that's what that's referring to.
I have times touchstone if statement on line 11 seen that.
If the value of N N Q represent any number have got 7 image images so the N could represent any of those
numbers.
So if n is greater than these variable x does let that is greater than the length or variable x then
the slide index is equal to one which is is variable here.
If this N..
Okay the N and kahrizak again n n number.
If the variable n n is less than 1.
Displayed in death equals to hecks riches is variable.
Nineteen dollars meant saying that online 13 is a counter saying that for every Were our sequence to
zero is less than X does Lent.
Then I should increase by 1 so every time the value of i is set to zero and then R is less than the
length of the variable X..
Don't increase it by 1 plus blogs means increase.
You keep increasing the number of lies as you flugge TRUE on till it gets to the last one and then by
14 saying if X. Okay parsee X into an array.
If X helped.
I don't see how to split is none.
That is if there is no display displays none.
Then say X dots flat index minus one dot style display equals block then display the images as block.
That's what that say.
So this is the style in the script that queer's dysfunctionality for our slide.
So I'll save that now run the code and see what it looks like.
So after.
That should work correctly now so if I click on this I should be able to Flutey you can see here the
images are of the same size.
Okay so I can keep looking through.
I can also move.
Go back one and go back to to.
These are all the seven images added to the slide.
So thanks for watching.
I hope the project has been useful.
If you've got any questions please feel free to ask.
Thank you.
Bye for now.